* Funk, Paul and Philips
* "Point Break: Using Machine Learning to Uncover a Critical Mass in Women’s Representation", Forthcoming at PSRM
*
*
* Last Updated: 7/19/21
* Replication for Tables 1 (education), 2 (health), and 3 (defense) in SI
* -----------------------------------------------------------------------------
use funk-paul-philips-replication.dta, clear
set seed 590381
xtset newccode year


*-------------------------------------------------------------------------------
* VARIABLE PREP

* FOR EDUCATION (critical mass intervals 20.5% and 39.5%) 
mkspline lessthan20pt5 20.5 equals20pt5tothirtyninept5 39.5 morethanthirtyninept5 = percent_women_Q, displayknots
tablist lessthan20pt5 equals20pt5tothirtyninept5 morethanthirtyninept5, sort(v)

* FOR HEALTH (critical mass interval between 15 and 30 percent)
mkspline lessthan15 15 equals15to30 30 morethan30 = percent_women_Q, displayknots
tablist lessthan15 equals15to30 morethan30, sort(v)

* FOR DEFENSE (critical limit point at 30 percent)
mkspline lessthan30defense 30 equals30andup  = percent_women_Q, displayknots
tablist lessthan30defense equals30andup, sort(v)


* Select 10-12 controls based on VIP

** population density, total population, % women in the legislature, % labor force female, anemia prevalence (% of women), % female population, polity, female labor force participation rate, trade, employment to population ratio, % rural population, imports -- will include % women separately
global educcontrols Populationdensitypeoplepers PopulationtotalSPPOPTOTL Laborforcefemaleoftotal Prevalenceofanemiaamongnonp Populationfemaleoftotal polity2 Laborforceparticipationrate TradeofGDPNETRDGNFSZS Employmenttopopulationratio Ruralpopulationoftotalpop Importsofgoodsandservices

** % female population, total population, population density, % rural population, trade, female life expectancy, age dependency ratio, % women in the legislature, imports, anemia prevalence (% of women), male labor force participation rate, % school enrollment
global healthcontrols Populationfemaleoftotal PopulationtotalSPPOPTOTL Populationdensitypeoplepers Ruralpopulationoftotalpop TradeofGDPNETRDGNFSZS Lifeexpectancyatbirthfemale Agedependencyratioofworki Importsofgoodsandservices Prevalenceofanemiaamongnonp P Schoolenrollmentprimarygr

** % rural population, polity, % female population, fertility rate, % labor force female, age dependency ratio, quota strenth (2), imports, population density, % women in the legislature, unemployment rate, male labor force participation rate
global milcontrols Ruralpopulationoftotalpop polity2 Populationfemaleoftotal Fertilityratetotalbirthspe Laborforcefemaleoftotal Agedependencyratioofworki quotastrength2 Importsofgoodsandservices Populationdensitypeoplepers Unemploymenttotaloftotal P

* Create year dummies (1975-2017)
tab year, ge(y) 
	
*-------------------------------------------------------------------------------
* PIECEWISE REGRESSION	

* EDUCATION

** Percent women, no breakpoints
reg percent_education percent_women_Q $educcontrols
estat ic 

** Critical interval (20.5%, 39.5%)
reg percent_education c.(lessthan20pt5 equals20pt5tothirtyninept5 morethanthirtyninept5) $educcontrols
estat ic 


* HEALTH

** Percent women, no breakpoints
reg percent_health percent_women_Q $healthcontrols
estat ic 

** Critical interval (15-30%)
reg percent_health c.(lessthan15 equals15to30 morethan30) $healthcontrols 
estat ic 

* DEFENSE

** Percent women, no breakpoint
reg percent_military percent_women_Q $milcontrols
estat ic 

** Critical upper limit at 30%
reg percent_military c.(lessthan30defense equals30andup) $milcontrols 
estat ic 


*-------------------------------------------------------------------------------
* ALTERNATIVE MODELING SPECIFICATIONS: LDV, RE, FE, FE with year dummies


********************************************************************************
* EDUCATION
********************************************************************************

** LDV ** 

** Percent women, no breakpoints
reg percent_education l.percent_education percent_women_Q $educcontrols
estat ic 

** Critical interval (20.5%, 39.5%)
reg percent_education l.percent_education c.(lessthan20pt5 equals20pt5tothirtyninept5 morethanthirtyninept5) $educcontrols
estat ic

** FE **

** Percent women, no breakpoints
xtreg percent_education percent_women_Q $educcontrols , fe
estat ic

** Critical interval (20.5%, 39.5%)
xtreg percent_education c.(lessthan20pt5 equals20pt5tothirtyninept5 morethanthirtyninept5) $educcontrols , fe
estat ic


** FE with year dummies (2000-2016) **

** Percent women, no breakpoints
xtreg percent_education percent_women_Q $educcontrols y26-y41, fe
estat ic

** Critical interval (20.5%, 39.5%)
xtreg percent_education c.(lessthan20pt5 equals20pt5tothirtyninept5 morethanthirtyninept5) $educcontrols y26-y41, fe
estat ic


** RE **

** Percent women, no breakpoints
xtreg percent_education percent_women_Q $educcontrols , mle 
estat ic


** Critical interval (20.5%, 39.5%)
xtreg percent_education c.(lessthan20pt5 equals20pt5tothirtyninept5 morethanthirtyninept5) $educcontrols , mle
estat ic


********************************************************************************
* HEALTH
********************************************************************************

** LDV ** 

** Percent women, no breakpoints
reg percent_health l.percent_health percent_women_Q $healthcontrols
estat ic 

** Critical interval (15-30%)
reg percent_health l.percent_health c.(lessthan15 equals15to30 morethan30) $healthcontrols 
estat ic

** FE **

** Percent women, no breakpoints
xtreg percent_health percent_women_Q $healthcontrols , fe
estat ic

** Critical interval (15-30%)
xtreg percent_health c.(lessthan15 equals15to30 morethan30) $healthcontrols , fe
estat ic

** FE with year dummies (2000-2016) **

** Percent women, no breakpoints
xtreg percent_health percent_women_Q $healthcontrols y26-y41, fe
estat ic 

** Critical interval (15-30%)
xtreg percent_health c.(lessthan15 equals15to30 morethan30) $healthcontrols y26-y41, fe
estat ic

** RE ** 

** Percent women, no breakpoints
xtreg percent_health percent_women_Q $healthcontrols , mle
estat ic 

** Critical interval (15-30%)
xtreg percent_health c.(lessthan15 equals15to30 morethan30) $healthcontrols , mle
estat ic


********************************************************************************
* DEFENSE
********************************************************************************

** LDV **

** Percent women, no breakpoint
reg percent_military l.percent_military percent_women_Q $milcontrols
estat ic 

** Critical upper limit at 30%
reg percent_military l.percent_military c.(lessthan30defense equals30andup) $milcontrols 
estat ic

** FE **

** Percent women, no breakpoint
xtreg percent_military percent_women_Q $milcontrols , fe
estat ic 

** Critical upper limit at 30%
xtreg percent_military c.(lessthan30defense equals30andup) $milcontrols , fe
estat ic

** FE with year dummies (2000-2016) **

** Percent women, no breakpoint
xtreg percent_military percent_women_Q $milcontrols y26-y41, fe
estat ic

** Critical upper limit at 30%
xtreg percent_military c.(lessthan30defense equals30andup) $milcontrols y26-y41, fe
estat ic

** RE ** 

** Percent women, no breakpoint
xtreg percent_military percent_women_Q $milcontrols , mle
estat ic

** Critical upper limit at 30%
xtreg percent_military c.(lessthan30defense equals30andup) $milcontrols , mle
estat ic

*-------------------------------------------------------------------------------
* EVALUATE EQUIVALENCY OF SLOPES TO TEST CRITICAL MASS EFFECT 

*-------------------------------------------------------------------------------
* PIECEWISE LINEAR REGRESSION
*-------------------------------------------------------------------------------

** Education
qui reg percent_education c.(lessthan20pt5 equals20pt5tothirtyninept5 morethanthirtyninept5) $educcontrols
test lessthan20pt5 = equals20pt5tothirtyninept5 
test equals20pt5tothirtyninept5 = morethanthirtyninept5 
test lessthan20pt5 = morethanthirtyninept5 

** Health
qui reg percent_health c.(lessthan15 equals15to30 morethan30) $healthcontrols 
test lessthan15 = equals15to30  
test equals15to30 = morethan30 
test lessthan15 = morethan30 

** Defense
qui reg percent_military c.(lessthan30defense equals30andup) $milcontrols 
test lessthan30defense = equals30andup 

*-------------------------------------------------------------------------------
* LDV
*-------------------------------------------------------------------------------

** Education 
qui reg percent_education l.percent_education c.(lessthan20pt5 equals20pt5tothirtyninept5 morethanthirtyninept5) $educcontrols
test lessthan20pt5 = equals20pt5tothirtyninept5 
test equals20pt5tothirtyninept5 = morethanthirtyninept5 
test lessthan20pt5 = morethanthirtyninept5 

** Health
reg percent_health l.percent_health c.(lessthan15 equals15to30 morethan30) $healthcontrols 
test lessthan15 = equals15to30  
test equals15to30 = morethan30 
test lessthan15 = morethan30 

** Defense
qui reg percent_military l.percent_military c.(lessthan30defense equals30andup) $milcontrols 
test lessthan30defense = equals30andup 


*-------------------------------------------------------------------------------
* FE
*-------------------------------------------------------------------------------

** Education 
qui xtreg percent_education c.(lessthan20pt5 equals20pt5tothirtyninept5 morethanthirtyninept5) $educcontrols , fe
test lessthan20pt5 = equals20pt5tothirtyninept5 
test equals20pt5tothirtyninept5 = morethanthirtyninept5 
test lessthan20pt5 = morethanthirtyninept5 

** Health
qui xtreg percent_health c.(lessthan15 equals15to30 morethan30) $healthcontrols , fe
test lessthan15 = equals15to30  
test equals15to30 = morethan30 
test lessthan15 = morethan30 

** Defense
qui xtreg percent_military c.(lessthan30defense equals30andup) $milcontrols , fe
test lessthan30defense = equals30andup 


*-------------------------------------------------------------------------------
* FE with year dummies
*-------------------------------------------------------------------------------

** Education 
qui xtreg percent_education c.(lessthan20pt5 equals20pt5tothirtyninept5 morethanthirtyninept5) $educcontrols y26-y41, fe
test lessthan20pt5 = equals20pt5tothirtyninept5 
test equals20pt5tothirtyninept5 = morethanthirtyninept5 
test lessthan20pt5 = morethanthirtyninept5 

** Health
qui xtreg percent_health c.(lessthan15 equals15to30 morethan30) $healthcontrols y26-y41, fe
test lessthan15 = equals15to30  
test equals15to30 = morethan30 
test lessthan15 = morethan30 

** Defense
qui xtreg percent_military c.(lessthan30defense equals30andup) $milcontrols y26-y41, fe
test lessthan30defense = equals30andup 


*-------------------------------------------------------------------------------
* RE
*-------------------------------------------------------------------------------

** Education 
qui xtreg percent_education c.(lessthan20pt5 equals20pt5tothirtyninept5 morethanthirtyninept5) $educcontrols , mle
test lessthan20pt5 = equals20pt5tothirtyninept5 
test equals20pt5tothirtyninept5 = morethanthirtyninept5 
test lessthan20pt5 = morethanthirtyninept5 

** Health
qui xtreg percent_health c.(lessthan15 equals15to30 morethan30) $healthcontrols , mle
test lessthan15 = equals15to30 
test equals15to30 = morethan30
test lessthan15 = morethan30 

** Defense
qui xtreg percent_military c.(lessthan30defense equals30andup) $milcontrols , mle
test lessthan30defense = equals30andup 



	
	
	
	
	
	
	
	
	
	
